package com.zkane.utils;

import com.alibaba.fastjson.JSONObject;
import lombok.Data;

/**
 * JSON响应结果类
 * <p></p>
 *
 * @author: SPL
 * @date: 11/14 0014 11:52
 */
@Data
public class Result<T> {
    private Integer code;
    private String msg;
    private T data;


    public static Result success(String msg){
        Result result=new Result();
        result.code=0;
        result.msg=msg;
        return result;
    }

    public static Result success(JSONObject data){
        Result result=new Result();
        result.code=0;
        result.msg="success";
        result.data=data;
        return result;
    }

    public static Result error(String msg){
        Result result=new Result();
        result.code=-1;
        result.msg=msg;
        return result;
    }

}
